<?php

namespace app\admin\service\admin;

use app\admin\model\admin\Config as ConfigModel;
use think\facade\Db;
use think\facade\Log;

class ConfigService
{

    /**
     * 获取配置项
     * @param string $category
     * @return array
     */
    public static function getConfigArray(string $category = 'public'): array
    {
        $config = ConfigModel::field('key,value')
            ->where(['status' => 1, 'category' => $category])
            ->select()->toArray();
        $data = array_column($config, 'value', 'key');
        return $data;
    }

}